export interface SipServiceLoggers {
    error?: SipLoggerError;
    send?: SipLoggerSend;
    recv?: SipLoggerRecv;
}

export interface SipServiceOptions {
    logger?: SipServiceLoggers;
    address?: string;//默认0.0.0.0
    port?: number;//默认5060
    publicAddress?: string;
    hostname?: string;
}

export interface SipMessageHeaders {
    [key: string]: any;
}

export interface SipRemote {
    protocol: string;
    address: string;
    port: number;
    local: any;
}

export interface SipCallback {
    (message: SipMessage, remote: SipRemote, stream?: Buffer): void;
}

export interface SipURI {
    schema?: string;
    user?: string;
    password?: string;
    host?: string;
    port?: number;
    params?: any;
    headers?: any;
}

export interface SipMessage {
    method?: string;//req
    uri?: string|SipURI;//req
    version?: string;//req/res
    status?: number;//res
    reason?: string;//res
    headers: SipMessageHeaders;
    content?: string;
    [key: string]: any;
}

export interface SipLoggerError {
    (error: Error): void
}

export interface SipLoggerSend {
    (message: SipMessage, target: any): void
}

export interface SipLoggerRecv {
    (message: SipMessage, remote: SipRemote): void
}